<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>LogWeb | Log in</title>
    <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="node_modules/adminlte/dist/css/AdminLTE.min.css"/>
    <script type="text/javascript" src="public/javascripts/md5.min.js"></script>
</head>
<body class="hold-transition login-page">
<div class="login-box">
    <div class="login-logo">
        <a href="#"><b>LogWeb</b></a>
    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">

        <form action="login" method="post" onsubmit="return verify();">
            <div class="form-group has-feedback">
                <input type="text" id="name" name="name" class="form-control" placeholder="Username">
                <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <input type="password" id="password" class="form-control" placeholder="Password">
                <input type="hidden" name="pwd" id="pwd">
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>
            <div class="row">
                <!-- /.col -->
                <div class="col-xs-4 col-xs-offset-4">
                    <input type="submit" class="btn btn-primary btn-block btn-flat" value="登录"></input>
                </div>
                <!-- /.col -->
            </div>
        </form>


    </div>
    <!-- /.login-box-body -->
</div>
<!-- /.login-box -->

<script>
    var search = window.location.search;
    if (search && search.indexOf('_error') !== 0) {
        alert(decodeURI(search.substring(8)));
    }

    function verify() {
        var name = document.getElementById('name'), password = document.getElementById('password'), pwd = document.getElementById('pwd');
        if (!name.value.trim()) {
            alert('请输入用户名!');
            return false;
        }
        if (!password.value.trim()) {
            alert('请输入密码');
            return false;
        }
        pwd.value = md5(password.value);
        return true;
    }
</script>

</body>
</html>